import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui' // 按需引入elementui
import 'element-ui/lib/theme-chalk/index.css' // 全局引入elementui的css文件
import './assets/less/index.less'

import store from './store'
import router from './router' // 引入vue路由
import http from 'axios'
import loadingPlugin from './plugin/loading'
import util from './plugin/util';

import esButton from '@/components/common/EsButton'
import esItem from '@/components/common/EsItem'


import { mapActions, mapState } from 'vuex'

import Print from './plugin/print'
Vue.use(Print) // 注册

Vue.config.productionTip = false

Vue.prototype.$http = http

// 全局注入elementui，会引入全部的组件，增大了项目的体积
Vue.use(ElementUI, {size: 'mini'})
// 全局注入loading
Vue.use(loadingPlugin)
Vue.use(util)

//全局组件


Vue.mixin({
  computed:{
    ...mapState('common',['selections'])
  },
  methods: {
    ...mapActions('common',['getSelections']),
     delay(ms) {
      return new Promise(resolve => setTimeout(resolve, ms));
    },
    //分页相关()
   /* sizeChange(size){
      this.table.pageConfig.size = size
      this.search()
    },
    currentChange(current){
      this.table.pageConfig.current = current
      this.search()
    },
    del(row){
      this.handleDelete(row.id)
    },
    edit(row){
      this.handleEdit(row)
    },
    selectionChange(val){
      // console.log(11)
      this.ids = val.map(item => item.id) // [{},{},{}] => [1,2,3]
    }*/
  }
})


new Vue({
  store, router, beforeCreate() {
    Vue.prototype.$bus = this // 安装全局事件总线
  }, render: (h) => h(App)
}).$mount('#app');


